package com.itheima.file;

import java.io.File;
import java.io.IOException;

public class Demo02 {

    public static void main(String[] args) throws IOException {
        File file = new File("day12\\a.txt");
        System.out.println(file.getPath());
        System.out.println(file.getAbsolutePath());

        File file1 = new File("d:\\itheima\\a.txt");
        System.out.println(file1.getPath());//获取路径  创建对象时 用的啥  返回啥
        System.out.println(file1.getAbsolutePath());

        File file2 = new File("day12\\b.txt");
        if(!file2.exists()){
            file2.createNewFile();
        }
        File file3 = new File("day13\\a.txt");
        if(!file3.exists()){
            file3.createNewFile();//要想创建文件, 文件夹必须提前存在
        }
    }
}
